import {
    BaseController,
    BeanFactory,
    Controller,
    DataType,
    PutMapping,
    Resource,
    Result
} from "csap-typescript-vue2/lib";
import {ApiDocPathForm, ApiDocPathList, ApiDocPathSearch} from "@/api/model/ApiDocPathModel";
import {ApiDocPathService} from "@/api/service/ApiDocPathService";
import {AxiosPromise} from "axios";

/**
 * 文档路径
 */
@Controller("apiDocPath")
export class ApidocPathController extends BaseController<ApiDocPathService, ApiDocPathForm, ApiDocPathSearch, ApiDocPathList, number> implements BeanFactory {
    @Resource()
    apiDocPathService: ApiDocPathService;

    getService(): ApiDocPathService {
        return this.apiDocPathService;
    }

    getFormValidate(): Array<Function | ApiDocPathForm> {
        return [ApiDocPathForm];
    }

    @PutMapping("flushDoc", {dataType: DataType.PARAMS})
    flushDoc(pathId: number): AxiosPromise<Result<boolean>> {
        return this.getService().flushDoc(this.request({id: pathId}))
    }

}
